package com.atguigu.spzx.manager.controller;

import com.atguigu.spzx.manager.service.FileUpdateService;
import com.atguigu.spzx.model.vo.common.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/admin/system")
@Tag(name = "文件上传接口")
public class FileUpdateController {
    @Autowired
    private FileUpdateService fileUpdateService;

    @PostMapping("/fileUpload")
    @Operation(summary = "上传文件")
    public Result<String> fileUpdateService(@RequestParam("file") MultipartFile multipartFile){
        String fileUrl = fileUpdateService.fileUpload(multipartFile);

        return Result.OK(fileUrl);
    }
}
